<?php if (!defined('SERVER_ROOT')) { exit('No direct script access allowed');}
$this->template->title = 'Hệ thống hỗ trợ công tác quản lý cán bộ trường ĐHTG';
$v_pop_win = isset($_REQUEST['pop_win']) ? '_pop_win' : '';
$this->template->display('dsp_header' . $v_pop_win . '.php');
//------------------------------------------------------------------------------
$MA_CAN_BO ='';
$TEN_HOC_KY = Session::get(TIEP_DAU_NGU_SESSION.'HOC_KY_HIEN_TAI');
$MA_LOAI_BCKH ='';
$TEN_BCKH ='';
$SO_TAP_CHI = '';
$VI_TRI_TRANG = '';
$TEN_NHA_XUAT_BAN = '';
$NOI_LUU_TRU = '';
$THOI_GIAN_DANG = '';
while ($arr = $arr_single_bckh->FetchRow()){
    $MA_CAN_BO =$arr['MA_CAN_BO'];
    $TEN_HOC_KY = $arr['TEN_HOC_KY'];
    $MA_LOAI_BCKH =$arr['MA_LOAI_BCKH'];
    $TEN_BCKH =$arr['TEN_BCKH'];
    $SO_TAP_CHI = $arr['SO_TAP_CHI'];
    $VI_TRI_TRANG = $arr['VI_TRI_TRANG'];
    $TEN_NHA_XUAT_BAN = $arr['TEN_NHA_XUAT_BAN'];
    $NOI_LUU_TRU = $arr['NOI_LUU_TRU'];
    $THOI_GIAN_DANG = $arr['THOI_GIAN_DANG2'];
}
?>
<form name="frmMain" method="post" id="frmMain" action=""><?php
    echo $this->hidden('controller', $this->get_controller_url());
    echo $this->hidden('hdn_dsp_single_method', 'dsp_single_bckh');
    echo $this->hidden('hdn_dsp_all_method', 'dsp_all_bckh');
    echo $this->hidden('hdn_update_method', 'update_bckh');
    echo $this->hidden('hdn_delete_method', 'delete_bckh');
    echo $this->hidden('hdn_item_id', $TEN_BCKH);
    if ($TEN_BCKH == '') {
         echo $this->hidden('hdn_update_type', 'THEM_MOI');
    }else{
         echo $this->hidden('hdn_update_type', 'CAP_NHAT');
    }
    echo $this->hidden('pop_win', $v_pop_win);
    ?>
    <h2 style="text-align: center">Cập nhật BCKH</h2>
    <div class="Row">
        <div class="left-Col">Học kỳ <label class="required">(*)</label> </div>
        <div class="right-Col">
            <input type="text" name="txt_TEN_HOC_KY" id="txt_TEN_HOC_KY" value="<?php echo $TEN_HOC_KY; ?>"
                   class="inputbox" maxlength="255" style="width:95%"
                   onKeyDown="return handleEnter(this, event);"
                   data-allownull="no" data-validate="text"
                   data-name="học kỳ"
                   data-xml="no" data-doc="no"
                   readonly="readonly"
            />
        </div>
    </div>
    <div class="Row">
        <div class="left-Col">Loại BCKH <label class="required">(*)</label></div>
        <div class="right-Col">
            <select id="cbx_MA_LOAI_BCKH"  name="cbx_MA_LOAI_BCKH" style="width:96%">
                  <?php while ($arr = $arr_all_loaibckh->FetchRow()): ?>
                  <?php
                   $MA=$arr['MA_LOAI_BCKH'];
                   $TEN=$arr['TEN_LOAI_BCKH'];
                  ?>
                   <?php if($MA_LOAI_BCKH == $MA):?>
                     <option value="<?php echo $MA; ?>" selected="selected"><?php echo $TEN; ?></option>
                  <?php else:?>
                     <option value="<?php echo $MA; ?>" ><?php echo $TEN; ?></option>
                  <?php endif ?>
        <?php endwhile; ?>
            </select>
        </div>
    </div>
    <div class="Row">
        <div class="left-Col">Tên BCKH <label class="required">(*)</label> </div>
        <div class="right-Col">
              <input  type="text" name="txt_TEN_BCKH" id="txt_TEN_BCKH" value="<?php echo $TEN_BCKH; ?>"
                   class="inputbox" maxlength="255" style="width:95%"
                   onKeyDown="return handleEnter(this, event);"
                   data-allownull="no" data-validate="text"
                   data-name="tên BCKH"
                   data-xml="no" data-doc="no"
                  <?php if($TEN_BCKH != ''):?>
                      readonly="readonly"
                  <?php else:?>
                      autofocus="autofocus"
                  <?php endif ?>
            />

        </div>
    </div>

     <div class="Row">
        <div class="left-Col">Tên NXB<label class="required">(*)</label> </div>
        <div class="right-Col">
            <input type="text" id="txt_TEN_NHA_XUAT_BAN"  name="txt_TEN_NHA_XUAT_BAN" value="<?php echo $TEN_NHA_XUAT_BAN; ?>"
                   class="inputbox" size="4" maxlength="300" style="width:95%"
                   data-allownull="no"
                   data-name="thứ tự hiển thị"
                   data-xml="no" data-doc="no"
             />
        </div>
    </div>
    <div class="Row">
        <div class="left-Col">Số tạp chí</div>
        <div class="right-Col">
            <input type="text" id="txt_SO_TAP_CHI"  name="txt_SO_TAP_CHI" value="<?php echo $SO_TAP_CHI; ?>"
                   class="inputbox" size="4" maxlength="300" style="width:95%"
                   data-allownull="no"
                   data-name="thứ tự hiển thị"
                   data-xml="no" data-doc="no"
             />
        </div>
    </div>
    <div class="Row">
        <div class="left-Col">Vị trí trang</div>
        <div class="right-Col">
            <input type="text" id="txt_VI_TRI_TRANG"  name="txt_VI_TRI_TRANG" value="<?php echo $VI_TRI_TRANG; ?>"
                   class="inputbox" size="4" maxlength="300" style="width:95%"
                   data-allownull="no"
                   data-name="thứ tự hiển thị"
                   data-xml="no" data-doc="no"
             />
        </div>
    </div>

    <div class="Row">
        <div class="left-Col">Nơi lưu trữ</div>
        <div class="right-Col">
            <input type="text" id="txt_NOI_LUU_TRU"  name="txt_NOI_LUU_TRU" value="<?php echo $NOI_LUU_TRU; ?>"
                   class="inputbox" size="4" maxlength="300"
                   style="width:95%"
                   data-name="thứ tự hiển thị"
                   data-xml="no" data-doc="no"
             />
        </div>
    </div>
    <div class="Row">
        <div class="left-Col">Thời gian đăng</div>
        <div class="right-Col">
            <input type="text" id="txt_THOI_GIAN_DANG"  name="txt_THOI_GIAN_DANG" value="<?php echo $THOI_GIAN_DANG; ?>"
                   class="inputbox" size="4" maxlength="300"
                    style="width:95%"
                   data-name="thứ tự hiển thị"
                   data-xml="no" data-doc="no"
             />
        </div>
    </div>
    <div class="button-area">
        <input type="button" name="update" class = 'button save' value="Cập nhật" onclick="btn_update_onclick();"/>
        <?php $v_back_action = ($v_pop_win === '') ? 'btn_back_onclick();' : 'try{window.parent.hidePopWin();}catch(e){window.close();};';?>
        <input type="button" name="cancel" class = 'button close' value="Bỏ qua" onclick="<?php echo $v_back_action;?>"/>
    </div>

</form>
<?php $this->template->display('dsp_footer' .$v_pop_win . '.php');